#!/bin/sh

# CD boottime initializations.

echo -n "Creating ramdisks:"

# Set up a ramdisk to make a read-only part of the directory tree writable
# $1 : ramdisk dev node to use
# $2 : path to make writeable
# $3 : ramdisk size in blocks
create_ramdisk()
{
	echo -n " $2"
	ramdisk $3 /dev/$1 > /dev/null
	mkfs.mfs /dev/$1 > /dev/null

	# copy files
	mount /dev/$1 /mnt > /dev/null
	(cd $2 && pax -rw . /mnt)

	umount /mnt > /dev/null
	mount /dev/$1 $2 > /dev/null
}

# Create /var ramdisk
create_ramdisk ram0 /var 768
create_ramdisk ram1 /tmp 128
create_ramdisk ram2 /usr/run 64
create_ramdisk ram3 /root 512

echo
